package com.gbb.simple.ui;

import android.os.Bundle;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener;

import com.gbb.simple.R;
import com.gbb.simple.base.BaseFragmentActivity;
import com.gbb.common.utils.ToastUtil;

/**
 * 下拉刷新组件
 *
 * @author gaobingbing
 */
public class SwipeRefreshActivity extends BaseFragmentActivity {

    private SwipeRefreshLayout swipeRefreshLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_swipe_refresh);
        swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.v4_swipeRefresh);
        this.swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

            @Override
            public void onRefresh(){
                ToastUtil.showToast("下拉刷新");
                SwipeRefreshActivity.this.swipeRefreshLayout.setRefreshing(false);
            }
        });

    }

}
